package T10_newSingleThreadScheduledExecutor;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class T10_newSingleThreadScheduledExecutor {    
    public static void main(String[] args) {    
        ScheduledExecutorService pool = Executors.newSingleThreadScheduledExecutor();    
        Thread t1 = new MyThread();    
        Thread t2 = new MyThread();    
        Thread t3 = new MyThread();    
        Thread t4 = new MyThread();    
        Thread t5 = new MyThread();    
        pool.execute(t1);    
        pool.execute(t2);    
        pool.execute(t3);  
        pool.schedule(t4, 1000, TimeUnit.MILLISECONDS);    
        pool.schedule(t5, 2000, TimeUnit.MILLISECONDS);    
        pool.shutdown();    
    }    
}    
class MyThread extends Thread {    
	@Override    
	public void run() {    
        System.out.println(Thread.currentThread().getName() + "正在执行。。。");    
	}    
}  
